package com.ruoyi.lyj.consumption.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.lyj.consumption.mapper.ConsumptionMapper;
import com.ruoyi.lyj.consumption.domain.Consumption;
import com.ruoyi.lyj.consumption.service.IConsumptionService;

/**
 * 消费记录Service业务层处理
 * 
 * @author lcl
 * @date 2021-03-26
 */
@Service
public class ConsumptionServiceImpl implements IConsumptionService 
{
    @Autowired
    private ConsumptionMapper consumptionMapper;

    /**
     * 查询消费记录
     * 
     * @param id 消费记录ID
     * @return 消费记录
     */
    @Override
    public Consumption selectConsumptionById(Long id)
    {
        return consumptionMapper.selectConsumptionById(id);
    }

    /**
     * 查询消费记录列表
     * 
     * @param consumption 消费记录
     * @return 消费记录
     */
    @Override
    public List<Consumption> selectConsumptionList(Consumption consumption)
    {
        return consumptionMapper.selectConsumptionList(consumption);
    }

    /**
     * 新增消费记录
     * 
     * @param consumption 消费记录
     * @return 结果
     */
    @Override
    public int insertConsumption(Consumption consumption)
    {
        consumption.setCreateTime(DateUtils.getNowDate());
        return consumptionMapper.insertConsumption(consumption);
    }

    /**
     * 修改消费记录
     * 
     * @param consumption 消费记录
     * @return 结果
     */
    @Override
    public int updateConsumption(Consumption consumption)
    {
        consumption.setUpdateTime(DateUtils.getNowDate());
        return consumptionMapper.updateConsumption(consumption);
    }

    /**
     * 批量删除消费记录
     * 
     * @param ids 需要删除的消费记录ID
     * @return 结果
     */
    @Override
    public int deleteConsumptionByIds(Long[] ids)
    {
        return consumptionMapper.deleteConsumptionByIds(ids);
    }

    /**
     * 删除消费记录信息
     * 
     * @param id 消费记录ID
     * @return 结果
     */
    @Override
    public int deleteConsumptionById(Long id)
    {
        return consumptionMapper.deleteConsumptionById(id);
    }
}
